package jtk.project4.fleet.screen.poReceived ;

import java.awt.FlowLayout;

import jtk.project4.fleet.field.PurchaseOrderField;
import jtk.project4.fleet.field.PurchaseOrder1Field;
import nl.coderight.jazz.form.FormField;
import nl.coderight.jazz.form.FormHeader;
import nl.coderight.jazz.form.FormView;
import nl.coderight.jazz.form.control.GroupControl;
import nl.coderight.jazz.form.field.button.PushButton;

public class PurchaseOrderView extends FormView{
	private FormHeader formHeader;
	private PushButton submitButton;
	private PushButton cancelButton;
	@Override
	protected void init() {
		// TODO Auto-generated method stub	
		CreateFields();
		CreateLayout();
	}
	
	private void CreateFields() {
		submitButton = new PushButton("Submit");
		cancelButton = new PushButton("Cancel");
	}
	
	private void CreateLayout() {
		setHeader(CreateHeader());
		addField(CreateForm());
	}
	
	private FormHeader CreateHeader(){
		formHeader = new FormHeader();
		formHeader.setTitle("PurchaseOrderPrts.header.form");
		return formHeader;
	}
	
	private FormField CreateForm(){
		GroupControl form = new GroupControl();
		form.addField(new PurchaseOrderField("Purchase Order"),NORTH);
		form.addField(new PurchaseOrder1Field("Purchase Order"),CENTER);
		form.addField(CreateButtons(),SOUTH);
		return form;
	}
	
	private GroupControl CreateButtons() {
		GroupControl buttons = new GroupControl();
		buttons.setLayout(new FlowLayout(FlowLayout.RIGHT));
		buttons.addField(submitButton);
		buttons.addField(cancelButton);
		return buttons;
	}
}